package cn.com.wdjedu.androidapp.wjeduandroid.mvp.video;

import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.mvputils.BasePresenter;
import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.mvputils.RxSubscribe;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by CCY on 2017/2/22.
 */

public class videoPresenter extends BasePresenter<videoview> {

    private videoDao videodao;

    public videoPresenter(videoview view) {
        videodao = new videoDao();
    }

    public void queryVideoData(int groupId){
        mView.showLoading();
        subscription=videodao.queryVideoData(groupId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new RxSubscribe<videoBean>() {
                    @Override
                    public void _onNext(videoBean VideoBean) {
                        if (mView!=null){
                            mView.queryNewVideoData(VideoBean);
                        }
                    }

                    @Override
                    public void _onError(String message) {
                        showError(message);
                    }
                });
    }

}
